package com.tdkj.action.backstage.decorate;

import java.util.List;
import javax.annotation.Resource;
import com.tdkj.action.BaseAction;
import com.tdkj.model.decorate.BeanStyle;
import com.tdkj.service.decorate.IBeanStyleService;

public class StyleAction extends BaseAction {
    
	private IBeanStyleService styleService;
	
	private List<BeanStyle> styles ;
	
	private BeanStyle style ;
	
	public String execute() {
		styles = styleService.findAll(BeanStyle.class);
		
		return "success";
	}
	
	public String add() {
		styleService.save(style);
		return execute();
	}
	
	public String update() {
		styleService.saveOrUpdate(style, BeanStyle.class);
		return execute();
	}

	public String delete() {
		styleService.delete(style.getId(), BeanStyle.class);
		return execute();
	}
	
	public String edit() {
		style = styleService.findById(style.getId(), BeanStyle.class);
		return "edit";
	}

	public List<BeanStyle> getStyles() {
		return styles;
	}

	public void setStyles(List<BeanStyle> styles) {
		this.styles = styles;
	}

	public BeanStyle getStyle() {
		return style;
	}

	public void setStyle(BeanStyle style) {
		this.style = style;
	}

	@Resource
	public void setStyleService(IBeanStyleService styleService) {
		this.styleService = styleService;
	}

	
}
